﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Web.Http;

namespace MGXAPI.Controllers.API
{
    public class CommController : ApiController
    {
        public static string environment = ConfigurationManager.AppSettings["WebApiEnvironment"];
        public static string webSiteUrl = ConfigurationManager.AppSettings["WebSiteUrl"];
        public static string testWebSiteUrl = ConfigurationManager.AppSettings["TestWebSiteUrl"];
        public static string localWebSiteUrl = ConfigurationManager.AppSettings["LocalWebSiteUrl"];

        /// <summary>
        /// App获取Api环境
        /// http://localhost:13772/api/Comm/GetApiEnvironment
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetApiEnvironment()
        {
            string url = null;
            switch (environment)
            {
                case "1":
                    url = webSiteUrl;
                    break;
                case "2":
                    url = testWebSiteUrl;
                    break;
                case "3":
                    url = localWebSiteUrl;
                    break;
                default:
                    url = webSiteUrl;
                    break;
            }
            return url;
        }
    }
}